-- pet_click
-- create by cheny3
-- 世界树史莱姆点击

return {
    -- 判断
    canTrigger = function(args)
        -- 在主地图上才可以
        local uiForm = AutoOperationM.getCurForm();
        local formName = uiForm:getName();
        return formName == "UITalentMain";
    end,

    -- 触发
    trigger = function(args)
        local uiForm = UIMgr.getCurrentScene():getFormByName("UITalentMain");
        -- 所有史莱姆节点
        local slimeParent = uiForm.slimeParent;
        local list = slimeParent:getChildren();
        -- 随机一个点击的节点
        local clickNode = list[math.random(#list)];
        -- 点击事件
        AutoOperationM.dispatchClickEvent(clickNode);
        return true;
    end,
};
